package com.duolaibei.business.view.dialog;

import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.widget.TextView;

import com.duolaibei.business.R;
import com.duolaibei.business.base.BaseDialog;
import com.duolaibei.business.utils.inject.Inject;

public class PhotoChooseDialog extends BaseDialog implements View.OnClickListener {
    public PhotoChooseDialog(Context context) {
        super(context);
    }

    public PhotoChooseDialog(Context context, int themeResId) {
        super(context, themeResId);
    }

    protected PhotoChooseDialog(Context context, boolean cancelable, DialogInterface.OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
    }

    @Override
    protected void onSetContentView() {
        setContentView(R.layout.dialog_photochoose);
    }

    @Override
    protected void initViews() {
        initWindow(1.0f, 0, Gravity.BOTTOM);
        setAnimate(R.style.animatedialog);
    }

    @Override
    protected void onSetListener() {
        tv_camera.setOnClickListener(this);
        tv_dcim.setOnClickListener(this);
        tv_cancel.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.tv_camera:
                if (listener != null) {
                    listener.onSelectedCamera();
                }
                break;
            case R.id.tv_dcim:
                if (listener != null) {
                    listener.onSelectedDCIM();
                }
                break;
            case R.id.tv_cancel:
                break;
        }
        cancel();
    }

    @Override
    protected void afterOnCreate(Bundle savedInstanceState) {

    }

    @Inject(R.id.tv_camera)
    private TextView tv_camera;
    @Inject(R.id.tv_dcim)
    private TextView tv_dcim;
    @Inject(R.id.tv_cancel)
    private TextView tv_cancel;

    private Listener listener;

    public void setListener(Listener listener) {
        this.listener = listener;
    }

    public static class Listener {
        public void onSelectedCamera() {
        }

        public void onSelectedDCIM() {
        }
    }
}
